from page.main_page import MainPage
from common.page import IOS
from selenium.common.exceptions import NoSuchElementException
from time import sleep


class NetProjectPage(MainPage):

    def enter_tools(self, tools_name):
        self.swipe_dr('up')
        for i in range(5):
            try:
                self.get_frame_center_and_click(
                    (IOS, 'type=="XCUIElementTypeStaticText" AND label == "%s"' % tools_name)
                )
            except NoSuchElementException:
                sleep(1)
                self.swipe_dr('up')
                continue
            else:
                break
        sleep(3)
